open Common

let id = {
  let counter = ref(0)
  () => {
    incr(counter)
    counter.contents
  }
}

let editorItemList = list{
  Floor(Regular, Empty),
  Floor(Regular, Boulder(id(), Hard)),
  Floor(Regular, Boulder(id(), Cracked)),
  Floor(Regular, Player(id(), Down, list{Forward, Forward})),
  Floor(FilledPit(id(), Hard), Empty), // We don't need filled pit
  Wall,
  Pit,
  Floor(Spinner(CW), Empty),
  Floor(Spinner(CCW), Empty),
}

let emptyLevel = {
  title: "Editor",
  items: editorItemList,
  map: Serialize.emptyMap(11, 11),
}

let boulderPitTutorial = {
  title: "Press Play",
  items: list{},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Player(id(), Right, list{Forward, Forward, Forward, Forward})),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let placeBoulderTutorial = {
  title: "Just Drag a Boulder",
  items: list{Floor(Regular, Boulder(id(), Hard))},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Player(id(), Right, list{Forward, Forward, Forward, Forward})),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let multiPitTutorial = {
  title: "Little More Interesting",
  items: list{Floor(Regular, Boulder(id(), Hard)), Floor(Regular, Boulder(id(), Hard))},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(
        Regular,
        Player(
          id(),
          Left,
          list{
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
          },
        ),
      ),
      Wall,
    },
    list{Wall, Floor(Regular, Empty), Pit, Floor(Regular, Empty), Floor(Regular, Empty), Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let multiPushBoulderTutorial = {
  title: "Picking up a Package",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(
        Regular,
        Player(
          id(),
          Left,
          list{
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Wall,
    },
    list{Wall, Floor(Regular, Empty), Pit, Pit, Floor(Regular, Empty), Floor(Regular, Empty), Wall},
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let dontbreak1 = {
  title: "Disappearing Trick",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Pit,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let dontbreak2 = {
  title: "Please Don't Break Again",
  items: list{Floor(Regular, Boulder(id(), Hard)), Floor(Regular, Boulder(id(), Hard))},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Pit,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
          },
        ),
      ),
      Floor(Regular, Boulder(id(), Hard)),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let boulderWall1 = {
  title: "Crunch",
  items: list{Floor(Regular, Boulder(id(), Hard)), Floor(Regular, Boulder(id(), Hard))},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Pit,
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let level1 = {
  title: "Tutorial",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
    },
    list{
      Floor(
        Regular,
        Player(id(), Right, list{Forward, Forward, Forward, Forward, TurnLeft, Forward}),
      ),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Boulder(id(), Hard)),
      Pit,
      Floor(Regular, Empty),
    },
    list{
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
    },
  },
}

let level2 = {
  title: "Tutorial",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
    },
    list{
      Floor(
        Regular,
        Player(id(), Right, list{Forward, Forward, Forward, Forward, TurnLeft, Forward}),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
    },
    list{
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
    },
  },
}

let ambiguousPath1 = {
  title: "Ambiguity",
  // items: editorItemList,
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Wall,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let ambiguousPath2 = {
  title: "Looks Familiar...",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Wall,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let ambiguousPath3 = {
  title: "Just One More",
  // items: editorItemList,
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Wall,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let small1 = {
  title: "Tight Quarters",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            TurnRight,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            TurnLeft,
            Forward,
            TurnRight,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let zigzag1 = {
  title: "Zig Zag",
  items: list{
    Floor(Regular, Boulder(id(), Cracked)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
  },
  // items: editorItemList,
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let withAFriend = {
  title: "Fun with a Friend",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Regular, Boulder(id(), Cracked)),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Wall,
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Right,
          list{
            Forward,
            TurnRight,
            Forward,
            Forward,
            TurnRight,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            TurnRight,
            TurnRight,
            TurnLeft,
            TurnLeft,
            TurnRight,
            TurnLeft,
            TurnLeft,
            TurnRight,
            TurnRight,
            TurnLeft,
            TurnLeft,
          },
        ),
      ),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Boulder(id(), Hard)),
      Wall,
    },
    list{Wall, Wall, Wall, Floor(Regular, Empty), Pit, Wall, Floor(Regular, Empty), Wall},
    list{
      Wall,
      Wall,
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Wall,
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Floor(Regular, Empty), Floor(Regular, Empty), Wall},
    list{
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Left,
          list{
            TurnLeft,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            TurnRight,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let rotateTutorial = {
  title: "Spinny",
  items: list{Floor(Spinner(CCW), Empty), Floor(Spinner(CW), Empty)},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{Wall, Floor(Regular, Empty), Wall, Pit, Wall, Floor(Regular, Empty), Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Boulder(id(), Hard)),
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Player(id(), Right, list{Forward, Forward, Forward, Forward})),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Floor(Regular, Empty), Wall, Pit, Wall, Floor(Regular, Empty), Wall},
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let bigSquare = {
  title: "Square Dancing",
  items: list{Floor(Regular, Boulder(id(), Hard)), Floor(Regular, Boulder(id(), Hard))},
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Wall,
      Floor(
        Regular,
        Player(
          id(),
          Down,
          list{
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnLeft,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnRight,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Wall,
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let finale = {
  title: "Finale",
  items: list{
    Floor(Regular, Boulder(id(), Hard)),
    Floor(Spinner(CW), Empty),
    Floor(Spinner(CCW), Empty),
  },
  map: list{
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
    list{
      Wall,
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Floor(
        Regular,
        Player(
          id(),
          Down,
          list{
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Pit,
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Pit,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Pit,
      Floor(Spinner(CCW), Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Spinner(CW), Empty),
      Floor(Spinner(CCW), Empty),
      Floor(Spinner(CCW), Empty),
      Pit,
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Boulder(id(), Hard)),
      Floor(Spinner(CCW), Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Pit,
      Floor(Regular, Empty),
      Pit,
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CW), Empty),
      Floor(Spinner(CW), Boulder(id(), Hard)),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Floor(Regular, Empty),
      Wall,
    },
    list{
      Wall,
      Floor(Spinner(CW), Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(
        Regular,
        Player(
          id(),
          Up,
          list{
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            Forward,
            TurnRight,
          },
        ),
      ),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Regular, Empty),
      Floor(Spinner(CCW), Empty),
      Wall,
    },
    list{Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall, Wall},
  },
}

let all = list{
  boulderPitTutorial,
  placeBoulderTutorial,
  multiPitTutorial,
  multiPushBoulderTutorial,
  boulderWall1,
  small1,
  dontbreak1,
  dontbreak2,
  zigzag1,
  ambiguousPath1,
  ambiguousPath2,
  ambiguousPath3,
  rotateTutorial,
  bigSquare,
  withAFriend,
  finale,
}

/* let all = [bigSquare]; */
